package @{package};

import java.sql.*;
import java.util.*;

import org.json.*;

import com.yonyou.uap.um.context.*;
import com.yonyou.uap.um.context.exception.*;
import com.yonyou.uap.um.entity.*;
import com.yonyou.uap.um.exception.*;
import com.yonyou.uap.um.pl.*;
import com.yonyou.uap.um.controller.*;

public class @{controllername} extends AbstractUMController
{ 
     @Override
     public String load(String args) {
        String resultStr = "";
        try {
            String filterStr = "";
            if (args != null && args.startsWith("{") && args.endsWith("}")
                    && args.contains(UMArgs.FILTER_KEY)) {
                JSONObject paraJsonObject = new JSONObject(args);
                filterStr = paraJsonObject.get(UMArgs.FILTER_KEY).toString();
            }
            @{mbe_id_upper}ExtendContext @{mbe_id_low}Context = new @{mbe_id_upper}ExtendContext();
            @{mbe_list_start_load}
            @{mbe_for_load}
            @{mbe_list_end_load}
            resultStr = UMArgs.replaceContextStr(@{mbe_id_low}Context.toString());
        } catch (Exception e) {
            e.printStackTrace();
        } 
        return resultStr;
    }


     @Override
     public String save(String args) {
        String resultStr = "";
        try {
            UMEventArgs umEventArgs = new UMEventArgs();
            umEventArgs.put("context", args);
            UMArgs umArgs = new UMArgs(umEventArgs);
            UMJSONContext context = umArgs.getUmjsonContext();
            @{mbe_id_upper}ExtendContext @{mbe_id_low}Context = new @{mbe_id_upper}ExtendContext();
            @{mbe_list_start_save}
            ISession session = PLSession.open();
            @{mbe_for_save}
            session.commit();
            @{mbe_list_end_save}
            resultStr = UMArgs.replaceContextStr(@{mbe_id_low}Context.toString());
        } catch (Exception e) {
            e.printStackTrace();
        } 
        return resultStr;
      }

}